package io.io2;

import java.io.*;

/**
 * 对象输出流：ObjectOutput
 * 对象输入流：ObjectInput
 */
public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String name="阿花";
        int age=88;
        String gender="女";
        String[] otherInfo={"是达内了的学生","广西南岭的","阿芬牌螺蛳粉只啦不吐"};
        Student af=new Student(name,age,gender,otherInfo);
        /**
         * 对象输出流在蓄力化对象是，必须包装序列化对象必须实现Serializable接口
         * 若没有实现序列化接口会发生NotSerializableException异常
         */
        System.out.println(af);
        FileOutputStream fos=new FileOutputStream("student.Obj");
        ObjectOutput oos=new ObjectOutputStream(fos);
        oos.writeObject(af);
        System.out.println("写出完毕！");

        oos.close();
    }
}
